<%@ page import="twitter4j.Twitter" %>
<%@ page import="twitter4j.User" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page session="true" %>
<html>
<head>
	<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/dojo/1.8.3/dijit/themes/claro/document.css" />
	<script src="//ajax.googleapis.com/ajax/libs/dojo/1.8.3/dojo/dojo.js"></script>
    <script type="text/javascript">
       require(["dojo/parser", "dijit/Dialog"]);
    </script>
	<title>Test Home</title>
</head>
<body class="claro">
<div style="margin-left:25%;margin-right:25%">
<jsp:include page="header.jsp"/>

<h1>
	Test Home!  
</h1>

<P>  The time on the server is ${serverTime}. </P>

	<%if(null == session.getAttribute("twitter")){%>
    <a href="../twitter/signin?redirectUrl=/test/home"><img src="../resources/images/Sign-in-with-Twitter-darker.png"/></a>
	<%}
	else{%>
	<h1>Welcome ${twitter.screenName} (${twitter.id})</h1>
	<%
		Twitter twitter = (Twitter) session.getAttribute("twitter");
		User twitterUser = twitter.showUser(twitter.getId());
		long id = twitter.getId();
		String name = twitterUser.getName();
		String screenName = twitterUser.getScreenName();
		String picUrl = twitterUser.getProfileImageURL();
		String bigPicUrl = twitterUser.getBiggerProfileImageURL();
		String miniPicUrl = twitterUser.getMiniProfileImageURL();
		//int numberOfFollowers = twitterUser.getFollowersCount();
		//int numberOfFriends = twitterUser.getFriendsCount();
	%>
	<table>
		<tr>
			<td><img src="<%= picUrl %>"/></td>
			<td><%= name %></td>			
		</tr>
	</table>
	<%}%>
</div>
</body>
</html>
